package com.xique.door.service.impl;

import java.util.List;

import com.xique.common.core.text.Convert;
import com.xique.common.core.utils.DateUtils;
import com.xique.door.bean.domain.DDeviceAdvert;
import com.xique.door.mapper.DDeviceAdvertMapper;
import com.xique.door.service.IDDeviceAdvertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 设备广告Service业务层处理
 * 
 * @author ww
 * @date 2022-03-11
 */
@Service
public class DDeviceAdvertServiceImpl implements IDDeviceAdvertService
{
    @Autowired
    private DDeviceAdvertMapper dDeviceAdvertMapper;

    /**
     * 查询设备广告
     * 
     * @param id 设备广告ID
     * @return 设备广告
     */
    @Override
    public DDeviceAdvert selectDDeviceAdvertById(Long id)
    {
        return dDeviceAdvertMapper.selectDDeviceAdvertById(id);
    }

    @Override
    public List<DDeviceAdvert> selectNotDDeviceAdvert(List<Long> ids,Long advertId) {
        return dDeviceAdvertMapper.selectNotDDeviceAdvert(ids,advertId);
    }

    /**
     * 查询设备广告列表
     * 
     * @param dDeviceAdvert 设备广告
     * @return 设备广告
     */
    @Override
    public List<DDeviceAdvert> selectDDeviceAdvertList(DDeviceAdvert dDeviceAdvert)
    {
        return dDeviceAdvertMapper.selectDDeviceAdvertList(dDeviceAdvert);
    }

    /**
     * 新增设备广告
     * 
     * @param dDeviceAdvert 设备广告
     * @return 结果
     */
    @Override
    public int insertDDeviceAdvert(DDeviceAdvert dDeviceAdvert)
    {
        dDeviceAdvert.setCreateTime(DateUtils.getNowDate());
        return dDeviceAdvertMapper.insertDDeviceAdvert(dDeviceAdvert);
    }

    /**
     * 修改设备广告
     * 
     * @param dDeviceAdvert 设备广告
     * @return 结果
     */
    @Override
    public int updateDDeviceAdvert(DDeviceAdvert dDeviceAdvert)
    {
        dDeviceAdvert.setUpdateTime(DateUtils.getNowDate());
        return dDeviceAdvertMapper.updateDDeviceAdvert(dDeviceAdvert);
    }

    /**
     * 删除设备广告对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteDDeviceAdvertByIds(String ids)
    {
        return dDeviceAdvertMapper.deleteDDeviceAdvertByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除设备广告信息
     * 
     * @param id 设备广告ID
     * @return 结果
     */
    @Override
    public int deleteDDeviceAdvertById(Long id)
    {
        return dDeviceAdvertMapper.deleteDDeviceAdvertById(id);
    }

    /**
     * @param deviceAdverts
     * @description: 批量插入
     * @author caogq
     * @date: 2022/3/13 13:32
     * @Param
     */
    @Override
    public int batchInsert(List<DDeviceAdvert> deviceAdverts) {
        return dDeviceAdvertMapper.batchInsert(deviceAdverts);
    }

    /**
     * @param deviceAdverts
     * @description: 批量更新
     * @author caogq
     * @date: 2022/3/13 13:32
     * @Param
     */
    @Override
    public int batchUpdate(List<DDeviceAdvert> deviceAdverts) {
        return dDeviceAdvertMapper.batchUpdate(deviceAdverts);
    }

    /**
     * @param id
     * @description: 删除设备绑定的广告信息
     * @author taojc
     * @date: 2022/8/17
     */
    @Override
    public void deleteDDeviceAvertDeviceById(Long id) {
        dDeviceAdvertMapper.deleteDDeviceAvertDeviceById(id);
    }

}
